-
Notifications
You must be signed in to change notification settings - Fork 0
integrity: signer and verifier implementation #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
integrity: signer and verifier implementation #15
Conversation
7dce61d to
679b87b
Compare
Pull Request Test Coverage Report for Build 19331947740Details
💛 - Coveralls |
b433eb8 to
809bb94
Compare
dc443ff to
7431a15
Compare
|
Last thing: add tests for running without privkey, pubkey and both pubkey/privkey.
|
7431a15 to
09d6eef
Compare
| Name() string | ||
| Verify(data []byte, signature []byte) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments for the public API missed.
| // Unmarshal implements interface. | ||
| func (m YAMLMarshaller) Unmarshal(data []byte, out any) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call is not tested.
| func (m YAMLMarshaller) Marshal(data any) ([]byte, error) { | ||
| marshalled, err := yaml.Marshal(data) | ||
| if err != nil { | ||
| return []byte{}, ErrMarshall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add a test for the error case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only way to trigger an error here - pass a channel or function as data. But in this case panic is triggered. So, do we exactly need tests this error case?
| func (m YAMLMarshaller) Unmarshal(data []byte, out any) error { | ||
| err := yaml.Unmarshal(data, &out) | ||
| if err != nil { | ||
| return ErrUnmarshall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add a test for the error case.
crypto/rsa_test.go
Outdated
| fmt.Fprintf(os.Stderr, "Error generating RSA key: %s", err) | ||
| return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fmt.Fprintf(os.Stderr, "Error generating RSA key: %s", err) | |
| return | |
| t.Fatalf(os.Stderr, "Error generating RSA key: %s", err) |
| func TestRsaOnlyPrivateKey(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| privateKey, err := rsa.GenerateKey(rand.Reader, 2048) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or it could be:
| privateKey, err := rsa.GenerateKey(rand.Reader, 2048) | |
| privateKey, err := rsa.GenerateKey(rand.Reader, 2048) | |
| require.NoError(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This, ty
crypto/rsa_test.go
Outdated
| privateKey, err := rsa.GenerateKey(rand.Reader, 2048) | ||
| if err != nil { | ||
| fmt.Fprintf(os.Stderr, "Error generating RSA key: %s", err) | ||
| return | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same.
crypto/rsa_test.go
Outdated
| privateKey, err := rsa.GenerateKey(rand.Reader, 2048) | ||
| if err != nil { | ||
| fmt.Fprintf(os.Stderr, "Error generating RSA key: %s", err) | ||
| return | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same.
2f38999 to
1decf59
Compare
Closes #TNTP-4171
1decf59 to
1dce6f3
Compare
Closes #TNTP-4171